package com.shop.member.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;
import com.shop.member.vo.MemberVO;

@Repository
public class MemberDeliverDAOImpl extends SqlSessionDaoSupport implements MemberDeliverDAO {

	
	@Override
	@SuppressWarnings("unchecked")
	public List<MemberVO.MemberDeliver> listDeliver() {
		Map<String , Object> paramMap = new HashMap<String, Object>();
		
		return getSqlSession().selectList("com.shop.member.deliver.list", paramMap);
	}
	
	@Override
	public int addDeliver(MemberVO.MemberDeliver deliverItem) {
		// TODO Auto-generated method stub
		int cnt = 0;
		cnt = (Integer)getSqlSession().insert("com.shop.member.deliver.add", deliverItem);
		
		return cnt;
	}
	
	@Override
	public MemberVO.MemberDeliver getDeliver(String deliver_seq) {
		Map<String , Object> paramMap = new HashMap<String, Object>();
		paramMap.put("seq", deliver_seq);
		return (MemberVO.MemberDeliver)getSqlSession().selectOne("com.shop.member.deliver.get", paramMap);
	}

	@Override
	public int updateDeliver(MemberVO.MemberDeliver deliverItem) {
		return getSqlSession().update("com.shop.member.deliver.update", deliverItem);
	}

	@Override 
	public int deleteDeliver(String deliver_seq) {
		Map<String , Object> paramMap = new HashMap<String, Object>();
		paramMap.put("seq", deliver_seq);
		
		return getSqlSession().delete("com.shop.member.deliver.delete", paramMap);
	}
}
